package com.atde._04_structural_design_patterns.flyweight;


/**
 * @BelongsProject: hsp_java_design_mode
 * @BelongsPackage: com.atde._04_structural_design_patterns.flyweight
 * @Author: Del
 * @CreateTime: 2025-06-23  15:15
 * @Description: 享元模式 --- 测试类
 * @Version: 1.0
 */
public class Client {
    public static void main(String[] args) {
        // 创建一个网站工厂
        WebSiteFactory webSiteFactory = new WebSiteFactory();
        WebSite category1 = webSiteFactory.getWebSiteCategory("新闻");
        category1.use(new User("张三"));

        WebSite category2 = webSiteFactory.getWebSiteCategory("博客");
        category2.use(new User("李四"));

        WebSite category3 = webSiteFactory.getWebSiteCategory("博客");
        category3.use(new User("王五"));

        int webSiteCount = webSiteFactory.getWebSiteCount();
        System.out.println("网站分类总数：" + webSiteCount);
    }
}
